package com.ruoyi.controller.system;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;

import cn.hutool.core.date.DateUtil;
import com.ruoyi.common.enums.*;
import com.ruoyi.common.exception.BusinessException;
import com.ruoyi.framework.web.domain.server.Sys;
import com.ruoyi.system.domain.*;
import com.ruoyi.system.mapper.SysUserAccountMapper;
import com.ruoyi.system.mapper.SysUserFreezeAmountMapper;
import com.ruoyi.system.service.*;
import com.ruoyi.system.vo.SysControlRes;
import com.ruoyi.system.vo.req.SysControlReq;
import com.ruoyi.system.vo.req.SysUserAccountEditReq;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.xmlbeans.impl.xb.xmlconfig.Usertypeconfig;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.shiro.service.SysPasswordService;
import com.ruoyi.framework.util.ShiroUtils;

/**
 * 用户信息
 * 
 * @author ruoyi
 */
@Controller
@RequestMapping("/system/user")
public class SysUserController extends BaseController
{
    private String prefix = "system/user";

    @Autowired
    private ISysUserService userService;

    @Autowired
    private ISysRoleService roleService;

    @Autowired
    private SysPasswordService passwordService;

    @Autowired
    private ISysChannelService sysChannelService;

    @Autowired
    private ISysChannelOutService sysChannelOutService;

    @Autowired
    private ISysControlService sysControlService;

    @Autowired
    private ISysUserChannelService sysUserChannelService;

    @Autowired
    private ISysUserChannelOutService sysUserChannelOutService;

    @Autowired
    private SysUserAccountMapper sysUserAccountMapper;

    @Autowired
    private SysUserFreezeAmountMapper sysUserFreezeAmountMapper;


    @RequiresPermissions("system:user:view")
    @GetMapping()
    public String user()
    {
        return prefix + "/user";
    }

    @RequiresPermissions("system:user:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(SysUser user)
    {
        SysUser nowUser = (SysUser) SecurityUtils.getSubject().getSession().getAttribute("user");
        startPage();
        List<SysUser> list = null;
        if (nowUser.getDeptId() == UserType.ADMIN.getCode() ||
                nowUser.getDeptId() == UserType.MINIADMIN.getCode() ||
                nowUser.getDeptId() == UserType.OPERATION.getCode()) {
            list = userService.selectUserList(user);
        }else if(nowUser.getDeptId() == UserType.HIGHAGENT.getCode()){
            user.setUserParentId(nowUser.getUserId());
            list = userService.selectHighAgentUserList(user);
        }else if(nowUser.getDeptId() == UserType.AGENT.getCode()){
            user.setUserParentId(nowUser.getUserId());
            list = userService.selectUserList(user);
        }
        return getDataTable(list);
    }

    @Log(title = "用户管理", businessType = BusinessType.EXPORT)
    @RequiresPermissions("system:user:export")
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(SysUser user)
    {
        SysUser nowUser = (SysUser) SecurityUtils.getSubject().getSession().getAttribute("user");
        List<SysUser> list = null;
        if (nowUser.getDeptId() == UserType.ADMIN.getCode() ||
                nowUser.getDeptId() == UserType.MINIADMIN.getCode() ||
                nowUser.getDeptId() == UserType.OPERATION.getCode()) {
            list = userService.selectUserList(user);
        }
        ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
        return util.exportExcel(list, "用户数据");
    }

    @Log(title = "用户管理", businessType = BusinessType.IMPORT)
    @RequiresPermissions("system:user:import")
    @PostMapping("/importData")
    @ResponseBody
    public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
    {
        ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
        List<SysUser> userList = util.importExcel(file.getInputStream());
        String operName = ShiroUtils.getSysUser().getLoginName();
        String message = userService.importUser(userList, updateSupport, operName);
        return AjaxResult.success(message);
    }

    @RequiresPermissions("system:user:view")
    @GetMapping("/importTemplate")
    @ResponseBody
    public AjaxResult importTemplate()
    {
        ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
        return util.importTemplateExcel("用户数据");
    }

    /**
     * 新增用户
     */
    @GetMapping("/add")
    public String add(ModelMap mmap)
    {
        SysUser user = (SysUser) SecurityUtils.getSubject().getSession().getAttribute("user");
        mmap.put("roles", roleService.selectRoleAll().stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
        List<SysUser> HignAgentList = null;
        //获取所有代理
        if (user.getDeptId() == UserType.ADMIN.getCode() ||
                user.getDeptId() == UserType.MINIADMIN.getCode() ||
                user.getDeptId() == UserType.OPERATION.getCode()) {
            HignAgentList = userService.getUserByTypeAndParent(UserType.HIGHAGENT.getCode(), -1L);
            List<SysUser> AgentList = userService.getUserByTypeAndParent(UserType.AGENT.getCode(), -1L);
            for (SysUser sysUser :
                    AgentList) {
                HignAgentList.add(sysUser);
            }
            mmap.put("agents",HignAgentList);
        }else {
            mmap.put("myinfo",user);
        }
        return prefix + "/add";
    }

    /**
     * 新增保存用户
     */
    @RequiresPermissions("system:user:add")
    @Log(title = "用户管理", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(@Validated SysUser user)
    {
        SysUser sysUser = (SysUser) SecurityUtils.getSubject().getSession().getAttribute("user");
        if (UserConstants.USER_NAME_NOT_UNIQUE.equals(userService.checkLoginNameUnique(user.getLoginName())))
        {
            return error("新增用户'" + user.getLoginName() + "'失败，登录账号已存在");
        }

        if (user.getUserParentId()!=null) {
            SysUser parents = userService.selectUserById(user.getUserParentId());
            if (user.getDeptId()<=parents.getDeptId()){
                return error("新增用户'" + user.getLoginName() + "'失败，用户类型不能高于或等于上级代理");
            }
        }

        if (user.getDeptId() == 100 || user.getDeptId()== 101){
            return error("用户类型不符合规范");
        }
        Long[] roleIds = new Long[1];
        //根据用户类型设置用户角色
        if (user.getDeptId() == UserType.ADMIN.getCode()){
            roleIds[0]= RoleType.ADMIN.getCode();
            user.setUserType(0);//用户类型（0系统管理员 1商户 2代理 3高级代理）
//            user.setRoleId(RoleType.ADMIN.getCode());
        } else if (user.getDeptId() == UserType.MINIADMIN.getCode()){
            roleIds[0]= RoleType.MINIADMIN.getCode();
            user.setUserType(0);//用户类型（0系统管理员 1商户 2代理 3高级代理）
//            user.setRoleId(RoleType.MINIADMIN.getCode());
        } else if (user.getDeptId() == UserType.OPERATION.getCode()){
            roleIds[0]= RoleType.OPERATION.getCode();
            user.setUserType(0);//用户类型（0系统管理员 1商户 2代理 3高级代理）
//            user.setRoleId(RoleType.OPERATION.getCode());
        } else if (user.getDeptId() == UserType.HIGHAGENT.getCode()){
            roleIds[0]= RoleType.HIGHAGENT.getCode();
            user.setUserType(3);//用户类型（0系统管理员 1商户 2代理 3高级代理）
//            user.setRoleId(RoleType.HIGHAGENT.getCode());
        } else if (user.getDeptId() == UserType.AGENT.getCode()){
            roleIds[0]= RoleType.AGENT.getCode();
            user.setUserType(2);//用户类型（0系统管理员 1商户 2代理 3高级代理）
//            user.setRoleId(RoleType.AGENT.getCode());
        } else if (user.getDeptId() == UserType.COMMON.getCode()){
            roleIds[0]= RoleType.COMMON.getCode();
            user.setUserType(1);//用户类型（0系统管理员 1商户 2代理 3高级代理）
//            user.setRoleId(RoleType.COMMON.getCode());
        }
        user.setRoleIds(roleIds);

        user.setSalt(ShiroUtils.randomSalt());
        user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
        user.setPayPassword(passwordService.encryptPassword(user.getLoginName(), user.getPayPassword(), user.getSalt()));
        user.setCreateBy(ShiroUtils.getLoginName());

        user.setUserKey(UUID.randomUUID().toString());
        user.setControlType(RuleType.SYSTEM.getCode());
        user.setWithdrawType(RuleType.SYSTEM.getCode());
        return toAjax(userService.insertUser(user));
    }

    /**
     * 修改用户
     */
    @GetMapping("/edit/{userId}")
    public String edit(@PathVariable("userId") Long userId, ModelMap mmap)
    {
        SysUser user = (SysUser) SecurityUtils.getSubject().getSession().getAttribute("user");
        List<SysUser> HignAgentList = null;
        //获取所有代理
        if (user.getDeptId() == UserType.ADMIN.getCode() ||
                user.getDeptId() == UserType.MINIADMIN.getCode() ||
                user.getDeptId() == UserType.OPERATION.getCode()) {
            SysUser checkUser = userService.selectUserById(userId);
            if (checkUser.getDeptId() == UserType.HIGHAGENT.getCode()){
                HignAgentList = new ArrayList<>();
            }else if(checkUser.getDeptId() == UserType.AGENT.getCode()){
                HignAgentList = userService.getUserByTypeAndParent(UserType.HIGHAGENT.getCode(), -1L);
            }else if(checkUser.getDeptId() == UserType.COMMON.getCode()){
                HignAgentList = userService.getUserByTypeAndParent(UserType.HIGHAGENT.getCode(), -1L);
                List<SysUser> AgentList = userService.getUserByTypeAndParent(UserType.AGENT.getCode(), -1L);
                for (SysUser sysUser :
                        AgentList) {
                    HignAgentList.add(sysUser);
                }
            }else {
                HignAgentList = new ArrayList<>();
            }
            mmap.put("agents",HignAgentList);
        }else {
            mmap.put("myinfo",user);
        }
        List<SysRole> roles = roleService.selectRolesByUserId(userId);
        mmap.put("user", userService.selectUserById(userId));
        mmap.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
        return prefix + "/edit";
    }

    /**
     * 修改保存用户
     */
    @RequiresPermissions("system:user:edit")
    @Log(title = "用户管理", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(@Validated SysUser user)
    {
        userService.checkUserAllowed(user);

        if (user.getUserParentId()!=null) {
            SysUser parents = userService.selectUserById(user.getUserParentId());
            if (parents.getDeptId()<=user.getDeptId()){
                return error("编辑用户'" + user.getLoginName() + "'失败，用户类型不能高于或等于上级代理");
            }
        }

        user.setUpdateBy(ShiroUtils.getLoginName());
        return toAjax(userService.updateUser(user));
    }

    @RequiresPermissions("system:user:resetPwd")
    @Log(title = "重置密码", businessType = BusinessType.UPDATE)
    @GetMapping("/resetPwd/{userId}")
    public String resetPwd(@PathVariable("userId") Long userId, ModelMap mmap)
    {
        mmap.put("user", userService.selectUserById(userId));
        return prefix + "/resetPwd";
    }

    @RequiresPermissions("system:user:resetPwd")
    @Log(title = "重置密码", businessType = BusinessType.UPDATE)
    @PostMapping("/resetPwd")
    @ResponseBody
    public AjaxResult resetPwdSave(SysUser user)
    {
        userService.checkUserAllowed(user);
        user.setSalt(ShiroUtils.randomSalt());
        user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
        if (userService.resetUserPwd(user) > 0)
        {
            if (ShiroUtils.getUserId().longValue() == user.getUserId().longValue())
            {
                ShiroUtils.setSysUser(userService.selectUserById(user.getUserId()));
            }
            return success();
        }
        return error();
    }

    /**
     * 进入授权角色页
     */
    @GetMapping("/authRole/{userId}")
    public String authRole(@PathVariable("userId") Long userId, ModelMap mmap)
    {
        SysUser user = userService.selectUserById(userId);
        // 获取用户所属的角色列表
        List<SysUserRole> userRoles = userService.selectUserRoleByUserId(userId);
        mmap.put("user", user);
        mmap.put("userRoles", userRoles);
        return prefix + "/authRole";
    }

    /**
     * 用户授权角色
     */
    @RequiresPermissions("system:user:add")
    @Log(title = "用户管理", businessType = BusinessType.GRANT)
    @PostMapping("/authRole/insertAuthRole")
    @ResponseBody
    public AjaxResult insertAuthRole(Long userId, Long[] roleIds)
    {
        userService.insertUserAuth(userId, roleIds);
        return success();
    }

    /**
     * 查看用户apikey
     */
    @RequiresPermissions("system:user:changeUserKey")
    @GetMapping("/getUserKey/{userId}")
    public String getUserKey(@PathVariable("userId") Long userId, ModelMap mmap)
    {
        SysUser user = userService.selectUserById(userId);
        if (user.getDeptId()<UserType.HIGHAGENT.getCode())
        {
            throw new BusinessException("管理员类用户无需用到此功能");
        }
        mmap.put("user", user);
        return prefix + "/userKey";
    }

    /**
     * 重设用户apikey
     */
    @RequiresPermissions("system:user:changeUserKey")
    @GetMapping("/changeUserKey/{userId}")
    @ResponseBody
    public String changeUserKey(@PathVariable("userId") Long userId, ModelMap mmap)
    {
        return UUID.randomUUID().toString();
    }

    /**
     * 重设用户apikey
     */
    @RequiresPermissions("system:user:changeUserKey")
    @Log(title = "重设用户密钥", businessType = BusinessType.UPDATE)
    @PostMapping("/changeUserKey")
    @ResponseBody
    public AjaxResult changeUserKey(SysUser sysUser)
    {
        sysUser.setUpdateBy(ShiroUtils.getLoginName());
        userService.updateUser(sysUser);
        return success();
    }

    /**
     * 查看用户谷歌秘钥
     */
    @RequiresPermissions("system:user:showGoogleKey")
    @GetMapping("/getUserGoogleKey/{userId}")
    public String showGoogleKey(@PathVariable("userId") Long userId, ModelMap mmap)
    {
        SysUser user = userService.selectUserById(userId);
        if (user.getDeptId()<UserType.HIGHAGENT.getCode()){
            throw new BusinessException("管理员类用户无需用到此功能");
        }
        mmap.put("user", user);
        SysUserGoogle sysUserGoogle = userService.selectUserGoogleKey(userId);
        mmap.put("sysUserGoogle", sysUserGoogle);
        return prefix + "/userGoogleKey";
    }

    @RequiresPermissions("system:user:remove")
    @Log(title = "用户管理", businessType = BusinessType.DELETE)
    @PostMapping("/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        try
        {
            return toAjax(userService.deleteUserByIds(ids));
        }
        catch (Exception e)
        {
            return error(e.getMessage());
        }
    }

    /**
     * 校验用户名
     */
    @PostMapping("/checkLoginNameUnique")
    @ResponseBody
    public String checkLoginNameUnique(SysUser user)
    {
        return userService.checkLoginNameUnique(user.getLoginName());
    }



    /**
     * 用户状态修改
     */
    @Log(title = "用户管理", businessType = BusinessType.UPDATE)
    @RequiresPermissions("system:user:edit")
    @PostMapping("/changeStatus")
    @ResponseBody
    public AjaxResult changeStatus(SysUser user)
    {
        userService.checkUserAllowed(user);
        return toAjax(userService.changeStatus(user));
    }

    /**
     * 用户充值状态修改
     */
    @Log(title = "用户管理", businessType = BusinessType.UPDATE)
    @RequiresPermissions("system:user:edit")
    @PostMapping("/changeDepositStatus")
    @ResponseBody
    public AjaxResult changeDepositStatus(SysUser user)
    {
        userService.checkUserAllowed(user);
        return toAjax(userService.changeDepositStatus(user));
    }

    /**
     * 查看用户入金通道
     */
    @RequiresPermissions("system:user:channel")
    @GetMapping("/viewUserChannel/{userId}")
    public String viewUserChannel(@PathVariable("userId") Long userId, ModelMap mmap)
    {
        SysUser user = userService.selectUserById(userId);
        if (user.getDeptId()<UserType.HIGHAGENT.getCode()){
            throw new BusinessException("管理员类用户无需用到此功能");
        }
        mmap.put("user", user);
        List<SysChannel> sysChannels = sysChannelService.selectUserSysChannel();
        mmap.put("sysChannels", sysChannels);
        SysUserChannel sysUserChannel = sysUserChannelService.selectSysUserChannelById(userId);
        if (sysUserChannel==null){
            sysUserChannel = new SysUserChannel();
        }
        mmap.put("sysUserChannel", sysUserChannel);
        return prefix + "/userChannel";
    }

    /**
     * 编辑用户入金通道
     */
    @Log(title = "编辑用户入金通道", businessType = BusinessType.UPDATE)
    @RequiresPermissions("system:user:channel")
    @PostMapping("/editUserChannel")
    @ResponseBody
    public AjaxResult editUserChannel(SysUserChannel sysUserChannel)
    {
        if (sysUserChannel.getUserChannelRate1()==null){
            throw new BusinessException("T+0费率不能为空");
        }
        if (sysUserChannel.getUserChannelRate2()==null){
            throw new BusinessException("其他费率不能为空");
        }
        if (sysUserChannel.getUserChannelFee()==null){
            throw new BusinessException("每笔额外收取费用不能为空");
        }
        if (sysUserChannelService.selectSysUserChannelById(sysUserChannel.getUserId())==null){
            sysUserChannelService.insertSysUserChannel(sysUserChannel);
        }
        return toAjax(sysUserChannelService.updateSysUserChannel(sysUserChannel));
    }

    /**
     * 查看用户出金通道
     */
    @RequiresPermissions("system:user:channelOut")
    @GetMapping("/viewUserChannelOut/{userId}")
    public String viewUserChannelOut(@PathVariable("userId") Long userId, ModelMap mmap)
    {
        SysUser user = userService.selectUserById(userId);
        if (user.getDeptId()<UserType.HIGHAGENT.getCode()){
            throw new BusinessException("管理员类用户无需用到此功能");
        }
        mmap.put("user", user);
        List<SysChannelOut> sysChannelOuts = sysChannelOutService.selectByUser(userId);
        mmap.put("sysChannelOuts", sysChannelOuts);
        SysUserChannelOut sysUserChannelOut = sysUserChannelOutService.selectSysUserChannelOutById(userId);
        if (sysUserChannelOut==null){
            sysUserChannelOut = new SysUserChannelOut();
        }
        mmap.put("sysUserChannelOut", sysUserChannelOut);
        return prefix + "/userChannelOut";
    }

    /**
     * 编辑用户出金通道
     */
    @Log(title = "编辑用户出金通道", businessType = BusinessType.UPDATE)
    @RequiresPermissions("system:user:channelOut")
    @PostMapping("/editUserChannelOut")
    @ResponseBody
    public AjaxResult editUserChannelOut(SysUserChannelOut sysUserChannelOut)
    {
        if (sysUserChannelOutService.selectSysUserChannelOutById(sysUserChannelOut.getUserId())==null){
            sysUserChannelOutService.insertSysUserChannelOut(sysUserChannelOut);
        }
        if (sysUserChannelOut.getUserChannelRate1()==null){
            throw new BusinessException("出金费率不能为空");
        }
        if (sysUserChannelOut.getUserChannelFee()==null){
            throw new BusinessException("每笔额外收取费用不能为空");
        }
        return toAjax(sysUserChannelOutService.updateSysUserChannelOut(sysUserChannelOut));
    }


    /**
     * 查看用户风控
     */
    @RequiresPermissions("system:user:control")
    @GetMapping("/viewUserControl/{userId}")
    public String viewUserControl(@PathVariable("userId") Long userId, ModelMap mmap)
    {
        SysUser sysUser = userService.selectUserById(userId);
        if (sysUser.getDeptId()<UserType.HIGHAGENT.getCode()){
            throw new BusinessException("管理员类用户无需用到此功能");
        }
        SysControlRes sysControlRes = sysControlService.selectSysControlByUser(userId);
        sysControlRes.setRelationId(userId);
        mmap.put("sysControl",sysControlRes);
        return prefix + "/userControl";
    }

    /**
     * 编辑用户风控
     */
    @RequiresPermissions("system:user:control")
    @Log(title = "编辑用户风控", businessType = BusinessType.UPDATE)
    @PostMapping("/editUserControl")
    @ResponseBody
    public AjaxResult editUserControl(@Validated SysControlReq sysControlReq)
    {
        SysUser sysUser = userService.selectUserById(sysControlReq.getRelationId());
        if (sysUser.getDeptId()<UserType.HIGHAGENT.getCode()){
            throw new BusinessException("管理员类用户无需用到此功能");
        }
        //选中个人规则
        if (sysControlReq.getControlType()==RuleType.PERSON.getCode()) {
            SysControlRes sysControlRes = sysControlService.selectSysControlByUser(sysControlReq.getRelationId());
            if (sysControlRes.getControlType() != RuleType.PERSON.getCode()) {
                sysControlReq.setControlId(null);
                SysControl sysControl = new SysControl();
                BeanUtils.copyProperties(sysControlReq, sysControl);
                sysControl.setStartTime(DateUtil.parse(sysControlReq.getStartTime()));
                sysControl.setEndTime(DateUtil.parse(sysControlReq.getEndTime()));
                sysControl.setControlType(RuleType.PERSON.getCode());
                return toAjax(sysControlService.insertSysControl(sysControl));
            }
            SysControl sysControl = new SysControl();
            BeanUtils.copyProperties(sysControlReq, sysControl);
            sysControl.setStartTime(DateUtil.parse(sysControlReq.getStartTime()));
            sysControl.setEndTime(DateUtil.parse(sysControlReq.getEndTime()));
            return toAjax(sysControlService.updateSysControl(sysControl));
        }

        //选中系统规则
        SysControlRes sysControlRes = sysControlService.selectSysControlByUser(sysControlReq.getRelationId());
        if (sysControlRes.getControlType() == RuleType.PERSON.getCode()) {
            return toAjax(sysControlService.deleteSysControlById(sysControlRes.getControlId()));
        }
        return success();
    }

    /**
     *  操作用户资金
     */
    @RequiresPermissions("system:user:editAccount")
    @GetMapping("/editAccount/{userId}")
    public String accountEdit(@PathVariable("userId") Long userId, ModelMap mmap)
    {
        SysUser user = userService.selectUserById(userId);
        if (user.getDeptId()<UserType.HIGHAGENT.getCode()){
            throw new BusinessException("管理员类用户无需用到此功能");
        }
        mmap.put("user", user);
        SysUserAccount sysUserAccount = sysUserAccountMapper.selectSysUserAccountById(userId);
        mmap.put("sysUserAccount", sysUserAccount);
        SysUserFreezeAmount search = new SysUserFreezeAmount();
        search.setUserId(userId);
        search.setStatus(FreezeStatus.FREEZE.getCode());
        List<SysUserFreezeAmount> sysUserFreezeAmounts = sysUserFreezeAmountMapper.selectSysUserFreezeAmountList(search);
        mmap.put("sysUserFreezeAmounts", sysUserFreezeAmounts);
        return prefix + "/userAccountEdit";
    }

    /**
     * 编辑用户资金
     */
    @RequiresPermissions("system:user:control")
    @Log(title = "编辑用户资金", businessType = BusinessType.UPDATE)
    @PostMapping("/editAccount")
    @ResponseBody
    public AjaxResult editAccount(@Validated SysUserAccountEditReq sysUserAccountEditReq){
        return null;
    }
}